#include "StdAfx.h"
#include "CJXCamera.h"

CCJXCamera::CCJXCamera(void)
{
	cameraInstance = NULL;
}

CCJXCamera::~CCJXCamera(void)
{
	if(cameraInstance != NULL){
		cvReleaseCapture(&cameraInstance);
		cameraInstance = NULL;
	}
}

CvCapture* CCJXCamera::getSingleCamera()
{
	if(cameraInstance == NULL)
	{
		cameraInstance = cvCaptureFromCAM(-1);
	}
	return cameraInstance;
}

CvCapture* CCJXCamera::getCamera(){
	return cvCaptureFromCAM(0);
}

CvCapture* CCJXCamera::cameraInstance = NULL;
